﻿using System;

class Test
{
    static void Main()
    {
        //a为下限，b为下限
        int a, b;
        Console.WriteLine("输入下限");
        a = int.Parse(Console.ReadLine());
        Console.WriteLine("输入上限");
        b = int.Parse(Console.ReadLine());

        if (a > b)
        {
            Console.WriteLine("下限大于上限");
            return;
        }
        bool[] prime = Get_Prime(b);

        int num = 0;
        for (int i = a; i <= b; i++)
        {
            if (prime[i])
            {
                Console.Write($"{i}"+"  ");
                num++;
                if (num % 10 == 0)
                {
                    Console.WriteLine();
                }
            }
           
            
        }

    }



    static bool[] Get_Prime(int n)
    {
        bool[] isPrime = new bool[n + 1];
        for (int i = 2; i <= n; i++)
        {
            isPrime[i] = true;

        }

        for (int p = 2; p * p <= n; p++)
        {
            if (isPrime[p])
            {
                for (int i = p * p; i <= n; i += p)
                    isPrime[i] = false;

            }
        }
        return isPrime;
    }


}

